// Copyright  2012 Petr TALLA. [petr.talla@gmail.com]
// This file is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This file is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY;  without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
// [http://www.gnu.org/copyleft/lesser.html]
//=============================================================================
package tc.common.utility;

import java.awt.Dimension;
import java.awt.Point;

import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSeparator;

import tc.crase.view.ViewXObject;

public class TcCmd {
	public static int SIDEBAR_WIDTH = 350;
	public static int COMPONENT_WIDTH = 300;
	
	public static TcCmd activeCommand = new TcCmd();
	public static JPanel dialog = new JPanel();
	
	protected JLabel label = new JLabel("aaaaaaaaaaa");
	protected JLabel hint  = new JLabel();
		
	protected JPanel panel = new JPanel();
	
	public static void setActiveCommand(TcCmd cmd)
	{	Dynbuff.dynamicBufferClean();		
		activeCommand = cmd;
		activeCommand.initializeDialog();
		dialog.repaint();
	}
	
	public void setHint(String text) {
		hint.setText("<html><p>" + text + "</p></html>");
	}
	
	public void initializeDialog() {
		dialog.removeAll();
		dialog.add(label);
		dialog.add(hint);
		
		JLabel separator2 = new JLabel("");
		separator2.setMaximumSize(new Dimension(320,6));
		dialog.add(separator2);
		
		JSeparator separator = new JSeparator(JSeparator.HORIZONTAL);
		separator.setMaximumSize(new Dimension(500, 40));
		dialog.add(separator);
	}
	
	public void finalizeDialog() {
		for (int i = 0; i < dialog.getComponentCount(); i++ )
		{	JComponent c = (JComponent)dialog.getComponent(i);
			if (c == null) continue;
			
			c.setAlignmentX(0.0f);
		}
	}
	
	public void setLabel(String value) {
		label.setText("<html>Mode: <b>" + value + "</b></html>");
	}
	
	public void enterPoint(Point pt, GrView view) {
	}
	public void enterReset(Point pt, GrView view) {
	}
	public void enterMove(Point pt, GrView view)  {
	}
}
